public class Test4 {
    public static void main(String[] args) {
        //求斐波那契数列的第n项。(迭代实现)
        //0,1,1,2,3,5,8,13,21.....  当前项的和等于前两项相加
        int n=9;

        int a=0;
        int b=1;
        int c=a+b;

        for(int i=3; i<n; ++i) {
            a=b;
            b=c;
            c=a+b;
        }
        System.out.println(c);
    }
}
